﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test.Model;

namespace Test.DAL
{
   public class StuInfoDAL:BaseDAL<StuInfo>
    {

        public List<StuInfo> Select(string name = "")
        {
            return Model.StuInfo.Where(p => p.Name.Contains(name)).ToList();
        }
        //public StuInfo Select(int id)
        //{
        //    return Model.StuInfo.Find(id);
        //}
        //public int Insert(StuInfo info)
        //{
        //    Model.StuInfo.Add(info);
        //    return Model.SaveChanges();
        //}
        //public int Delete(StuInfo info)
        //{
        //    Model.StuInfo.Remove(info);
        //    return Model.SaveChanges();
        //}
        public int Update(StuInfo info)
        {
            var cls = Model.StuInfo.Find(info.Id);
            cls.Name = info.Name;
            cls.Comment = info.Comment;
            cls.cid = info.cid;
            return Model.SaveChanges();
        }
    }
}
